package com.pan.utils;

import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

public enum UmlConfig {

    INSTANCE;
    private Properties properties;
    {
        properties = new Properties();
        try {
            properties.load(UmlConfig.class.getClassLoader().getResourceAsStream("UmlConfig.properties"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    public String get(String key){
        return properties.getProperty(key);
    }

    public Integer getWidthUnit(){
        return Integer.parseInt(properties.getProperty("class.unit.width"));
    }
    public Integer getWidth(int xSize){
        return xSize * getWidthUnit();
    }
    public Integer getHeightUnit(){
        return Integer.parseInt(properties.getProperty("class.unit.height"));
    }
    private static Integer lineHeight = 8;
    public Integer getHeight(int ySize){
        return (ySize + 1) * getHeightUnit() + lineHeight;
    }

    public Integer getX(){
        return Integer.parseInt(properties.getProperty("class.x"));
    }
    public Integer getY(){
        return Integer.parseInt(properties.getProperty("class.y"));
    }
    public Integer getXBetween(){
        return Integer.parseInt(properties.getProperty("class.between.x"));
    }
    public Integer getYBetween(){
        return Integer.parseInt(properties.getProperty("class.between.y"));
    }
    public Integer getLimitWidth(){
        return Integer.parseInt(properties.getProperty("picture.limit.width"));
    }

    public String getSaveDirPath(){
        return properties.getProperty("save.dir.path");
    }
}
